<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>贪婪模式</title>
</head>
<body>
	<p>
		12345678    \d{3,6}
	</p>
	
	<script type="text/javascript">
	var str = "12345678";
	alert(str.replace(/\d{3,6}/g, "贝"));   //贝78
	</script>
</body>
</html>